/*
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * The software in this package is published under the terms of the GPL v2.0
 * license, a copy of which has been included with this distribution in the
 * LICENSE-GPL.txt file.
 */

package org.cemantika.factory;

import org.cemantika.management.drools.DroolsContextualManipulation;
import org.cemantika.management.drools.dao.DaoDroolsContextualManipulation;
import org.cemantika.util.SpringUtil;

/**
 * DaoFactory represents the factory that instantiates all DAOs of CEManTIKA.
 *
 * @author andersonfellipe
 */
public class DaoFactory {

    /**
     * Represents the instance of the {@link DaoFactory}.
     */
    private static final DaoFactory instance = new DaoFactory();
    /**
     * Represents the DAO of {@link DroolsContextualManipulation}.
     */
    private DaoDroolsContextualManipulation daoDroolsContextualManipulation;
    
    /**
     * Creates a new instance of DaoFactory. It is private because this class implements the
     * design pattern singleton.
     */
    @SuppressWarnings("restriction")
    private DaoFactory() {
        daoDroolsContextualManipulation = (DaoDroolsContextualManipulation) SpringUtil.getApplicationContext().getBean("daoDroolsContextualManipulation");
    }
    
    /**
     * Represents the method to get the {@link DaoFactory} instance.
     * 
     * @return the singleton instance of the {@link DaoFactory}.
     */
    public static DaoFactory getInstance() {
        return instance;
    }

    /**
     * Get the daoDroolsContextualManipulation value.
     *
     * @return the daoDroolsContextualManipulation.
     */
    public DaoDroolsContextualManipulation getDaoDroolsContextualManipulation() {
        return daoDroolsContextualManipulation;
    }
    
}
